<?php

use console\services\MigrateService;
use yii\db\Migration;

/**
 * Handles the creation of table `sys_admin_role`.
 */
class m231229_144103_create_sys_admin_role_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_admin_role', [
            'id' => $this->bigPrimaryKey(),
            'admin_id' => $this->bigInteger()->defaultValue(0)->notNull()->comment('用户ID'),
            'role_id' => $this->bigInteger()->defaultValue(0)->notNull()->comment('角色ID'),
        ], MigrateService::createTableOptions('人员角色表'));
        $this->insert('sys_admin_role', ['admin_id' => 10000, 'role_id' => 1]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_admin_role');
    }
}
